home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk1.zip / LST10-4.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  585b  |  26 lines

  1. ;
  2. ; *** Listing 10-4 ***
  3. ;
  4. ; Searches a word-sized array for the first element
  5. ; greater than 10,000, using non-string instructions.
  6. ;
  7.     jmp    Skip
  8. ;
  9. WordArray    dw    1000 dup (0), 10001
  10. ;
  11. Skip:
  12.     call    ZTimerOn
  13.     mov    di,offset WordArray-2
  14.                 ;start 1 word early so the
  15.                 ; first preincrement points
  16.                 ; to the first element
  17.     mov    ax,10000    ;value we'll compare with
  18. SearchLoop:
  19.     inc    di        ;point to the next element
  20.     inc    di
  21.     cmp    ax,[di]        ;compare the next element
  22.                 ; to 10,000
  23.     jae    SearchLoop    ;if not greater than 10,000,
  24.                 ; do the next element
  25.     call    ZTimerOff
  26.